﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DDD4Fun.Observer;

namespace DDD4Fun.Ducks
{
    public class RedheadDuck : IQuackable
    {
        IObservable observable;

        public RedheadDuck()
        {
            this.observable = new DuckyObservable(this);
        }

        #region IQuackable Members

        public void Quack()
        {
            Console.WriteLine("RedheadDuck Quack.");
            NotifyObservers(this);
        }

        #endregion

        #region IObservable Members

        public void Register(Observer.IObserver anObserver)
        {
            observable.Register(anObserver);
        }

        public void UnRegister(Observer.IObserver anObserver)
        {
            observable.UnRegister(anObserver);
        }

        public void NotifyObservers(object anObject)
        {
            observable.NotifyObservers(anObject);
        }

        #endregion
    }
}
